<?php
include 'init.php';
require_once("./include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("index.php");
    exit;
}

include 'template/header.php';
?>

<h3>Albums</h3>

<?php

$albums = get_albums();

if (empty($albums)) {
  echo '<p>You don\'t have any albums</p>';
} else {
  foreach ($albums as $album) {
    echo '<p><a href="view_album_test.php?album_id=', $album['id'], '">', $album['name'], '</a> (', $album['count'], ' images)<br />
    ', $album['description'], '...<br />
    <a href="edit_album.php?album_id=', $album['id'], '">Edit</a> / <a href="delete_album.php?album_id=', $album['id'], '">Delete</a>
    </p>';
  }
 }

include 'template/footer.php';
?>
